package main

import (
	"os"
	platformio "platformio-analyzer-backend/pkg"

	"github.com/godbus/dbus/v5"
)

type Backend interface {
	platformio.PIO
	Exit() (err *dbus.Error)
}

// pio *PIOBackend PlatformIO
type PIOBackend struct {
	*platformio.PlatformIO
}

func NewPIOBackend() Backend {
	pio := platformio.NewPlatformIO(platformio.PlatformIOPath(platformio.PLATFORM_IO_PREFIX))
	return &PIOBackend{PlatformIO: pio.(*platformio.PlatformIO)}
}

func (service *PIOBackend) Exit() (err *dbus.Error) {
	os.Exit(0)
	return
}
